import React, { Component } from 'react';
import Router from './router/index'
import {withRouter} from 'react-router-dom'


class App extends Component {
  state={
    needlogin:['/see','/habit']   //需要被监听并且被阻止的路径
  }
  render() {
    return (
      <div>
      <Router/>
      </div>
    );
  }
  // componentDidMount(){
  //   this.props.history.listen(location =>{
   
  //     const bool =  this.state.needlogin.some(item=>{
  //      return  new RegExp(item).test(location.pathname)
  //     })
  //     if(!bool){
  //       this.props.history.push('/login')
  //      return
  //     }
  //    console.log(bool)
  //   })
  // }
}

export default withRouter(App);

